﻿// See https://aka.ms/new-console-template for more information
using LL2025.TimeTask.Lib;
using Quartz;
using static MyFirstJobswewe3;

// 创建并启动调度器

// 调度多个任务
// 调度多个任务
await Main.ScheduleJobAsync<MyFirstJobs>("定时采集", JobTriggerType.BySecond, interval: 1);
await Main.ScheduleJobAsync<MyFirstJobswewe>("MyFirstJobswewe", JobTriggerType.ByMinute, interval: 2);
await Main.ScheduleJobAsync<MySecondJob>("MySecondJob", JobTriggerType.ByHour, interval: 1);
await Main.ScheduleJobAsync<MyFirstJobswewe2>("MyFirstJobswewe2", JobTriggerType.Cron, cronExpression: "0 0/5 * * * ?");
await Main.ScheduleJobAsync<MyFirstJobswewe3>("MyFirstJobswewe3", JobTriggerType.Forever, interval: 10);
await Main.ScheduleJobAsync<MyFirstJobswewe4>("MyFirstJobswewe4", JobTriggerType.LimitedTimes, interval: 5, repeatCount: 5);

Console.WriteLine("Press any key to exit...");
Console.ReadKey();

// 关闭调度器
await Main.ShutdownAsync();
public class MyFirstJobs : IJob
{
    public Task Execute(IJobExecutionContext context)
    {
        //JobDetail.Key：标识JobDetail的唯一ID
        //Trigger.Key：标识Trigger的唯一ID
        Console.WriteLine($"1,撒大苏打阿松大：{DateTime.Now:yyyy-MM-dd HH:mm:ss}，" +
            $"工作明细：{context.JobDetail.Key.Name}，速度阿达：{context.Trigger.Key.Name}");
        return Task.CompletedTask; // Return a completed Task to ensure proper implementation

    }
}


public class MyFirstJobswewe : IJob
{
    public Task Execute(IJobExecutionContext context)
    {
        //JobDetail.Key：标识JobDetail的唯一ID
        //Trigger.Key：标识Trigger的唯一ID
        Console.WriteLine($"1,sdfsdfsdf：{DateTime.Now:yyyy-MM-dd HH:mm:ss}，" +
            $"工作明细：{context.JobDetail.Key.Name}，速度阿达：{context.Trigger.Key.Name}");
        return Task.CompletedTask; // Return a completed Task to ensure proper implementation

    }
}
public class MyFirstJobswewe2 : IJob
{
    public Task Execute(IJobExecutionContext context)
    {
        //JobDetail.Key：标识JobDetail的唯一ID
        //Trigger.Key：标识Trigger的唯一ID
        Console.WriteLine($"2,22222222222：{DateTime.Now:yyyy-MM-dd HH:mm:ss}，" +
            $"工作明细：{context.JobDetail.Key.Name}，速度阿达：{context.Trigger.Key.Name}");
        return Task.CompletedTask; // Return a completed Task to ensure proper implementation

    }
}
public class MyFirstJobswewe3 : IJob
{
    public Task Execute(IJobExecutionContext context)
    {
        //JobDetail.Key：标识JobDetail的唯一ID
        //Trigger.Key：标识Trigger的唯一ID
        Console.WriteLine($"3,333333：{DateTime.Now:yyyy-MM-dd HH:mm:ss}，" +
            $"工作明细：{context.JobDetail.Key.Name}，速度阿达：{context.Trigger.Key.Name}");
        return Task.CompletedTask; // Return a completed Task to ensure proper implementation

    }
    public class MyFirstJobswewe4 : IJob
    {
        public Task Execute(IJobExecutionContext context)
        {
            //JobDetail.Key：标识JobDetail的唯一ID
            //Trigger.Key：标识Trigger的唯一ID
            Console.WriteLine($"4,w11111：{DateTime.Now:yyyy-MM-dd HH:mm:ss}，" +
                $"工作明细：{context.JobDetail.Key.Name}，速度阿达：{context.Trigger.Key.Name}");
            return Task.CompletedTask; // Return a completed Task to ensure proper implementation

        }
    }

}